/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cs157a.util;

import javax.swing.JOptionPane;

/**
 * 
 * @author Mr.Nam
 */
public class CreateDropDataProject extends javax.swing.JFrame {

	/**
	 * Creates new form Test_Create_Drop
	 */
	public CreateDropDataProject() {
		initComponents();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */

	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jPanel1 = new javax.swing.JPanel();
		jBImportDB = new javax.swing.JButton();
		jBPrintTable = new javax.swing.JButton();
		jBDropDB = new javax.swing.JButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

		jBImportDB.setText("Import Project DB");
		jBImportDB.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jBImportDBActionPerformed(evt);
			}
		});
		jPanel1.add(jBImportDB);

		jBPrintTable.setText("Print Table Name");
		jBPrintTable.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jBPrintTableActionPerformed(evt);
			}
		});
		jPanel1.add(jBPrintTable);

		jBDropDB.setText("Drop Project DB");
		jBDropDB.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jBDropDBActionPerformed(evt);
			}
		});
		jPanel1.add(jBDropDB);

		getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

		pack();
	}// </editor-fold>//GEN-END:initComponents

	private void jBDropDBActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jBDropDBActionPerformed
		DataControl.dropProjectData();
	}// GEN-LAST:event_jBDropDBActionPerformed

	private void jBImportDBActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jBImportDBActionPerformed
		DataControl.updateProjectData();
	}// GEN-LAST:event_jBImportDBActionPerformed

	private void jBPrintTableActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jBPrintTableActionPerformed
		// TODO add your handling code here:
		JOptionPane.showMessageDialog(null, DataControl.printDBTableNames());
	}// GEN-LAST:event_jBPrintTableActionPerformed

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		/* Set the Nimbus look and feel */
		// <editor-fold defaultstate="collapsed"
		// desc=" Look and feel setting code (optional) ">
		/*
		 * If Nimbus (introduced in Java SE 6) is not available, stay with the
		 * default look and feel. For details see
		 * http://download.oracle.com/javase
		 * /tutorial/uiswing/lookandfeel/plaf.html
		 */
		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
					.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(
					CreateDropDataProject.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(
					CreateDropDataProject.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(
					CreateDropDataProject.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(
					CreateDropDataProject.class.getName()).log(
					java.util.logging.Level.SEVERE, null, ex);
		}
		// </editor-fold>

		/* Create and display the form */
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new CreateDropDataProject().setVisible(true);

			}
		});
	}

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JButton jBDropDB;
	private javax.swing.JButton jBImportDB;
	private javax.swing.JButton jBPrintTable;
	private javax.swing.JPanel jPanel1;
	// End of variables declaration//GEN-END:variables
}
